<!--
<!DOCTYPE html>
&lt;!&ndash;<%@ taglib prefix="c" uri="http://java.sun.co/zm/jsp/jstl/core" %>&ndash;&gt;
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>地理数据</title>
</head>

<script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js">
</script>

<style type="text/css">
    body{
        background-image: url(http://47.105.208.60:8080/wechat-api/images/loginbg.png);
        background-position: center center;
        background-repeat: no-repeat;
        background-attachment: fixed;
        background-size: cover;
    }
    table#table {
        margin-left:auto;
        margin-right:auto;
        background: #F7F7F7;
        opacity:0.95;
        padding: 25px 15px 25px 10px;
        font: 12px Georgia, "Times New Roman", Times, serif;
        color: #888;
        text-shadow: 1px 1px 1px #FFF;
        border:1px solid #E4E4E4;
        text-align:center;
    }
    body h1 {
        font-size: 50px;
        padding: 0px 0px 10px 40px;
        display: block;
        color: slategrey;
        text-align:center;
    }
    form#form .button {
        background: #E27575;
        border: none;
        padding: 10px 25px 10px 25px;
        margin:10px 20px 10px 100px;
        color: #FFF;
        box-shadow: 1px 1px 5px #B6B6B6;
        border-radius: 3px;
        text-shadow: 1px 1px 1px #9E3F3F;
        cursor: pointer;
    }
</style>

<script>
    //获取指定参数名的参数值
    function getQueryParameter(eid)
    {
        console.log(eid);
        var s = location.href;
        s = s.replace("?","?&").split("&");//这样可以保证第一个参数也能分出来
        var re = "";
        for(i=1;i<s.length;i++)
            if(s[i].indexOf(eid+"=")==0)
                re = s[i].replace(eid+"=","");//取代前面的参数名，只剩下参数值
        return re;
    }
    function onLoadByPage(){
        var num = getQueryParameter('eid')//获取id
        //后台查询数据
        var url="http://47.105.208.60:8080/wechat-api/api/findinfo";

        //var url="/api/findinfo";
        var objData = [
            { name: 'num', value: num}
        ];//post方式传送的数据
        var a;
        $.ajax({
            url: url
            , data: objData
            //JSON.stringify(objData)
            , dataType: 'json'
            , type: 'POST'
            , success: function (data) {
                console.log("+++++++")
                console.log(data)
                var contentArr ='';

                if (data != '') {
                    for (var index in data){

                        var num = data[index].num;
                        var title = data[index].title;
                        var address = data[index].address;
                        var latitude = data[index].latitude;
                        var longitude = data[index].longitude;
                        var username = data[index].username;
                        var phone = data[index].phone;
                        var written = data[index].written;
                        var summary = data[index].summary;
//                    var s = index+1;

                        var content = "<tr id='tr-"+index+"' class='tr'>"+
                            "<td> <input type='radio' name='xuanze' class='xuanze' ></td>"+
                            "<td class='id'>"+num+"</td>"+
                            "<td class='name'>"+title+"</td>"+
                            "<td class='address'>"+address+"</td>"+
                            "<td class='longitude'>"+longitude+"</td>"+
                            "<td class='latitude'>"+latitude+"</td>"+
                            "<td class='summary'>"+summary+"</td>"+
                            "<td class='report'>"+written+"</td>"+
                            "<td class='username'>"+username+"</td>"+
                            "<td class='userphone'>"+phone+"</td>"+
                            "</tr>";
                        contentArr += content
                        console.log(index)
//                    document.getElementById("id").innerHTML = data[0].num;
//                    document.getElementById("name").value = data[0].title
//                    document.getElementById("address").value = data[0].address
//                    document.getElementById("latitude").value = data[0].latitude
//                    document.getElementById("longitude").value = data[0].longitude
//                    document.getElementById("username").value = data[0].username
//                    document.getElementById("userphone").value = data[0].phone
//                    document.getElementById("report").value = data[0].written
                    }
                    document.getElementById("tbody").innerHTML = contentArr;
                }
                else
                {
                    console.log("========")
                    alert("操作失败");//请求传输失败回调函数
                }
            }
            , error: function (msg) {
                console.log("&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;")
                alert(msg); //错误信息

            }
        });
    }

    function setValue() {
        var  val1 =$('input:radio:checked').parent().parent("tr").find("td").eq(1).text();
        var  val2 =$('input:radio:checked').parent().parent("tr").find("td").eq(2).text();
        var  val3 =$('input:radio:checked').parent().parent("tr").find("td").eq(3).text();
        var  val4 =$('input:radio:checked').parent().parent("tr").find("td").eq(4).text();
        var  val5 =$('input:radio:checked').parent().parent("tr").find("td").eq(5).text();
        var  val6 =$('input:radio:checked').parent().parent("tr").find("td").eq(6).text();
        var  val7 =$('input:radio:checked').parent().parent("tr").find("td").eq(7).text();
        var  val8 =$('input:radio:checked').parent().parent("tr").find("td").eq(8).text();
        var  val9 =$('input:radio:checked').parent().parent("tr").find("td").eq(9).text();

        window.opener.document.getElementById("id").value = val1;
        window.opener.document.getElementById("name").value = val2;
        window.opener.document.getElementById("address").value = val3;
        window.opener.document.getElementById("longitude").value = val4;
        window.opener.document.getElementById("latitude").value = val5;
        window.opener.document.getElementById("summary").value = val6;
        window.opener.document.getElementById("report").value = val7;
        window.opener.document.getElementById("username").value = val8;
        window.opener.document.getElementById("userphone").value = val9;
        window.close();
    }

    onLoadByPage();
</script>


<body>
<h1 style="text-align: center">代言家庭信息</h1>
<div>

    <table border="1" id="table" style="height: 90%; width: 90%">
        <thead>
        <tr>
            <th></th>
            <th>农户编号</th>
            <th>农户名称</th>
            <th>农户所属乡镇</th>
            <th>经度</th>
            <th>纬度</th>
            <th>简介</th>
            <th>上报人</th>
            <th>联系人</th>
            <th>联系电话</th>
        </tr>
        <thead>

        <tbody id="tbody" class="tbody">

        </tbody>
    </table>

</div>

<div>

    <form id="form" action="" method="post">
        <input type="button" class="button" value="确定" onclick="setValue()">
    </form>

</div>
</body>
</html>-->
